package com.xuchaotong.concurrent;

import java.util.concurrent.CyclicBarrier;

public class MountainCyclicBarrier {
    private final static int N = 3;

    public static void main(String[] args) {
        CyclicBarrier cyclicBarrier = new CyclicBarrier(N, new Runnable() {
            @Override
            public void run() {
                System.out.println("当前线程：["+ Thread.currentThread().getName() +"]，是哪个线程？");
            }
        });

        for (int i = 0;i < N;i++){
            new Thread(new Mountaineer(cyclicBarrier),"MT" + i).start();
        }
    }
}
